package com.ease.util {
   import flash.display.DisplayObject;
   
   import mx.core.FlexGlobals;
   import mx.core.UIComponent;
   import mx.printing.FlexPrintJob;
   import mx.printing.FlexPrintJobScaleType;

   public class PrintManager {
      public function PrintManager() {
      }
      
      public static function doPrint(target:UIComponent):void {
         var printJob:FlexPrintJob = new FlexPrintJob();
         if (printJob.start()) {
//            FlexGlobals.topLevelApplication.addChild(target);
            
//            target.width = printJob.pageWidth;
//            target.height = printJob.pageHeight;
            printJob.addObject(target, FlexPrintJobScaleType.MATCH_WIDTH);
            printJob.printAsBitmap = false;
//            FlexGlobals.topLevelApplication.removeChild(target);
            printJob.send();
         }
      }
   }
}